//
//  BaseCell.m
//  Product_NEWS
//
//  Created by dllo on 16/1/8.
//  Copyright © 2016年 FCH. All rights reserved.
//

#import "BaseCell.h"

@implementation BaseCell




-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self) {
         self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
        [self initUI];
     
    }
    return self;
}


-(void)initUI
{
    
    self.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
  self.selectionStyle = UITableViewCellSelectionStyleNone;
    
}
//人数转换
-(NSString * )changePeople:(NSInteger)person
{
    UILabel *replyCount = [[UILabel alloc]init];
    
    if (person > 10000) {
        NSInteger temp = person / 10000;
        person = person % 10000 / 1000;
        
        replyCount.text = [NSString stringWithFormat:@"%lu.%lu万",temp, person];
    } else if (person == 0){
        replyCount.text = @"暂无评论";
    } else {
        replyCount.text = [NSString stringWithFormat:@"%lu",person];
    }
    
    return replyCount.text;
    
}

-(NSString * )exchangeReply:(NSInteger)person
{
    UILabel *replyCount = [[UILabel alloc]init];
   
    if (person > 10000) {
        NSInteger temp = person / 10000;
        person = person % 10000 / 1000;
        
        replyCount.text = [NSString stringWithFormat:@"%lu.%lu万跟帖",temp, person];
    } else if (person == 0){
        replyCount.text = @"暂无评论";
    } else {
        replyCount.text = [NSString stringWithFormat:@"%lu跟帖",person];
    }
    
    return replyCount.text;
    
}


//时间转换
- (NSString *)convertTime:(CGFloat)second{
    
    NSDateFormatter *fmt = [[NSDateFormatter alloc]init];
  
    NSDate *d = [NSDate dateWithTimeIntervalSince1970:second];
    if (second/3600 >= 1) {
        [fmt setDateFormat:@"HH:mm:ss"];
    } else {
        [fmt setDateFormat:@"mm:ss"];
    }
    NSString *showtimeNew = [fmt stringFromDate:d];
    return showtimeNew;
}

@end
